<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${packageMapper}.${table.nameClass}Mapper">

	<!-- 新增实体 -->
	<insert id="insert" parameterType="${packageEntity}.${table.nameClass}" useGeneratedKeys="true" keyProperty="id">
        insert into ${table.nameTable}
		<trim prefix="(" suffix=")" suffixOverrides=",">
<#list table.listColumn as column>
	<#if column.nameCol != "UpdateTime" && column.nameCol != "CreateTime" && column.nameCol != "Id">
		<#if column_has_next>
			<if test="${column.nameCol?uncap_first} != null">${column.nameCol},</if>
		<#else>
			<if test="${column.nameCol?uncap_first} != null">${column.nameCol}</if>
		</#if>
	</#if>
</#list>
		</trim>
		<trim prefix="values (" suffix=")" suffixOverrides=",">
<#list table.listColumn as column>
	<#if column.nameCol != "UpdateTime" && column.nameCol != "CreateTime" && column.nameCol != "Id">
		<#if column_has_next>
			<if test="${column.nameCol?uncap_first} != null">${r'#{'}${column.nameCol?uncap_first}${r'}'},</if>
		<#else>
			<if test="${column.nameCol?uncap_first} != null">${r'#{'}${column.nameCol?uncap_first}${r'}'}</if>
		</#if>
	</#if>
</#list>
		</trim>
    </insert>
    
    <!-- 通过id修改实体 -->
    <update id="update" parameterType="${packageEntity}.${table.nameClass}">
    	UPDATE ${table.nameTable}
		SET
			<trim suffixOverrides=",">
<#list table.listColumn as column>
	<#if column.nameCol != "UpdateTime" && column.nameCol != "CreateTime" && column.nameCol != "Id">
			<if test="${column.nameCol?uncap_first} != null">${column.nameCol} = ${r'#{'}${column.nameCol?uncap_first}${r'}'},</if>
	</#if>
</#list>
			</trim>
    	WHERE Id = ${r'#{'}id${r'}'}
    </update>

	<delete id="deleteTrue">
		delete from ${table.nameTable}
		where Id = ${r'#{'}id${r'}'}
	</delete>
</mapper>